home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Multiprocessing 2.1v2 SDK / Sample Code / MPEntryPointTest ƒ / MPEntryPointTest.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-04  |  6.5 KB  |  190 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        "MPEntryPointTest.c"
  3.     
  4.     Description:
  5.                 This is a application to test the MP Entrypoints.
  6.  
  7.     Version:    v0.0
  8.  
  9.     File Ownership:
  10.  
  11.         DRI:                George Warner
  12.  
  13.         Other Contact:        
  14.  
  15.         Technology:            MultiTasking/MultiProcessing
  16.  
  17.     Copyright:     © Copyright 2000 Apple Computer, Inc. All rights reserved.
  18.     
  19.     Disclaimer:    IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  20.                 ("Apple") in consideration of your agreement to the following terms, and your
  21.                 use, installation, modification or redistribution of this Apple software
  22.                 constitutes acceptance of these terms.  If you do not agree with these terms,
  23.                 please do not use, install, modify or redistribute this Apple software.
  24.  
  25.                 In consideration of your agreement to abide by the following terms, and subject
  26.                 to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
  27.                 copyrights in this original Apple software (the "Apple Software"), to use,
  28.                 reproduce, modify and redistribute the Apple Software, with or without
  29.                 modifications, in source and/or binary forms; provided that if you redistribute
  30.                 the Apple Software in its entirety and without modifications, you must retain
  31.                 this notice and the following text and disclaimers in all such redistributions of
  32.                 the Apple Software.  Neither the name, trademarks, service marks or logos of
  33.                 Apple Computer, Inc. may be used to endorse or promote products derived from the
  34.                 Apple Software without specific prior written permission from Apple.  Except as
  35.                 expressly stated in this notice, no other rights or licenses, express or implied,
  36.                 are granted by Apple herein, including but not limited to any patent rights that
  37.                 may be infringed by your derivative works or by other works in which the Apple
  38.                 Software may be incorporated.
  39.  
  40.                 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
  41.                 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  42.                 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  43.                 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  44.                 COMBINATION WITH YOUR PRODUCTS.
  45.  
  46.                 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  47.                 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  48.                 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  49.                 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  50.                 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
  51.                 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
  52.                 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  53.  
  54.     Writers:
  55.  
  56.         gaw    - George Warner
  57.  
  58.     Change History (most recent first):
  59.  
  60.          <1>    02/29/00    gaw     Initial build
  61.  
  62.     Author Initials:
  63.  
  64.     gaw - George Warner
  65.  
  66. */
  67.  
  68. #pragma mark compiler directives
  69.  
  70. #define DUMP_API_INFO(s) printf("%8.8lX: " #s ".\n",s)
  71.  
  72. #pragma mark #Includes
  73. #include <MacTypes.h>
  74. #include <Events.h>
  75. #include <Fonts.h>
  76. #include <Multiprocessing.h>
  77.  
  78. #include <stdio.h>            // for printf & fflush
  79. #include <SIOUX.h>            // for SIOUXSettings stuff
  80. #include <SIOUXGlobals.h>    // for SIOUXQuitting
  81.  
  82. #pragma mark typedefs, structs, enums, defines, etc.
  83.  
  84. #pragma mark exported functions
  85. void main(void)
  86. {
  87.     // Set the SIOUX window defaults
  88.     SIOUXSettings.autocloseonquit    = false;
  89.     SIOUXSettings.asktosaveonclose    = false;
  90.     SIOUXSettings.showstatusline    = false;
  91.     SIOUXSettings.columns            = 132;
  92.     SIOUXSettings.rows                = 24;
  93.     SIOUXSettings.fontsize            = 10;
  94.     GetFNum("\pMonaco",&SIOUXSettings.fontid);
  95.     SIOUXSettings.standalone        = true;
  96.  
  97.     printf("MPEntryPointTest Starting!\n");
  98.  
  99.     // Make sure that the MP library is loaded
  100.     if    (!MPLibraryIsLoaded())
  101.         printf("The MP library did not load.\n");
  102.  
  103.     {    // for giggles we'll dump out the MP Library version info
  104.         Ptr tVersionCStringPtr;
  105.         UInt32 major,minor,release,revision;
  106.  
  107.         _MPLibraryVersion(&tVersionCStringPtr,&major,&minor,&release,&revision);
  108.  
  109.         printf("\n Version: \"%s\", major: %ld, minor: %ld, release: %ld, revision: %ld.\n",tVersionCStringPtr,major,minor,release,revision);
  110.     }
  111.  
  112.     printf("\n");
  113.  
  114.     DUMP_API_INFO(AbsoluteToDuration);
  115.     DUMP_API_INFO(DurationToAbsolute);
  116.     DUMP_API_INFO(UpTime);
  117.  
  118.     DUMP_API_INFO(MPAllocate);
  119.     DUMP_API_INFO(MPAllocateAligned);
  120.     DUMP_API_INFO(MPAllocateTaskStorageIndex);
  121.     DUMP_API_INFO(MPArmTimer);
  122.     DUMP_API_INFO(MPBlockClear);
  123.     DUMP_API_INFO(MPBlockCopy);
  124.     DUMP_API_INFO(MPCancelTimer);
  125.     DUMP_API_INFO(MPCauseNotification);
  126.     DUMP_API_INFO(MPCreateCriticalRegion);
  127.     DUMP_API_INFO(MPCreateEvent);
  128.     DUMP_API_INFO(MPCreateNotification);
  129.     DUMP_API_INFO(MPCreateQueue);
  130.     DUMP_API_INFO(MPCreateSemaphore);
  131.     DUMP_API_INFO(MPCreateTask);
  132.     DUMP_API_INFO(MPCreateTimer);
  133.     DUMP_API_INFO(MPCurrentTaskID);
  134.     DUMP_API_INFO(MPDataToCode);
  135.     DUMP_API_INFO(MPDeallocateTaskStorageIndex);
  136.     DUMP_API_INFO(MPDelayUntil);
  137.     DUMP_API_INFO(MPDeleteCriticalRegion);
  138.     DUMP_API_INFO(MPDeleteEvent);
  139.     DUMP_API_INFO(MPDeleteNotification);
  140.     DUMP_API_INFO(MPDeleteQueue);
  141.     DUMP_API_INFO(MPDeleteSemaphore);
  142.     DUMP_API_INFO(MPDeleteTimer);
  143.     DUMP_API_INFO(MPDisposeTaskException);
  144.     DUMP_API_INFO(MPEnterCriticalRegion);
  145.     DUMP_API_INFO(MPExit);
  146.     DUMP_API_INFO(MPExitCriticalRegion);
  147.     DUMP_API_INFO(MPExtractTaskState);
  148.     DUMP_API_INFO(MPFree);
  149.     DUMP_API_INFO(MPGetAllocatedBlockSize);
  150.     DUMP_API_INFO(MPGetNextCpuID);
  151.     DUMP_API_INFO(MPGetNextTaskID);
  152.     DUMP_API_INFO(MPGetTaskStorageValue);
  153.     DUMP_API_INFO(MPModifyNotification);
  154.     DUMP_API_INFO(MPNotifyQueue);
  155.     DUMP_API_INFO(MPProcessors);
  156.     DUMP_API_INFO(MPProcessorsScheduled);
  157.     DUMP_API_INFO(MPRegisterDebugger);
  158.     DUMP_API_INFO(MPRemoteCall);
  159.     DUMP_API_INFO(MPSetEvent);
  160.     DUMP_API_INFO(MPSetExceptionHandler);
  161.     DUMP_API_INFO(MPSetQueueReserve);
  162.     DUMP_API_INFO(MPSetTaskState);
  163.     DUMP_API_INFO(MPSetTaskStorageValue);
  164.     DUMP_API_INFO(MPSetTaskWeight);
  165.     DUMP_API_INFO(MPSetTimerNotify);
  166.     DUMP_API_INFO(MPSignalSemaphore);
  167.     DUMP_API_INFO(MPTaskIsPreemptive);
  168.     DUMP_API_INFO(MPTerminateTask);
  169.     DUMP_API_INFO(MPThrowException);
  170.     DUMP_API_INFO(MPUnregisterDebugger);
  171.     DUMP_API_INFO(MPWaitForEvent);
  172.     DUMP_API_INFO(MPWaitOnQueue);
  173.     DUMP_API_INFO(MPWaitOnSemaphore);
  174.     DUMP_API_INFO(MPYield);
  175.  
  176. //    DUMP_API_INFO(_MPAllocateSys);
  177. //    DUMP_API_INFO(_MPDebugStr);
  178. //    DUMP_API_INFO(_MPInitializePrintf);
  179.     DUMP_API_INFO(_MPIsFullyInitialized);
  180.     DUMP_API_INFO(_MPLibraryIsCompatible);
  181.     DUMP_API_INFO(_MPLibraryVersion);
  182. //    DUMP_API_INFO(_MPPrintf);
  183. //    DUMP_API_INFO(_MPRPC);
  184. //    DUMP_API_INFO(_MPStatusCString);
  185. //    DUMP_API_INFO(_MPStatusPString);
  186. //    DUMP_API_INFO(_MPTaskIsToolboxSafe);
  187.  
  188.     printf("Done!\nPress command-Q to quit.\n");
  189. }
  190.